package com.hsnn.medstgmini.pro.project.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Transient;

import com.hsnn.medstgmini.util.FormatDate;

/**
 * ViewBidprojectId entity. @author MyEclipse Persistence Tools
 */
@Embeddable
public class ViewBidprojectId implements java.io.Serializable {

	// Fields

	private String projId;
	private String projCode;
	private String name;
	private String projCat;
	private short status;
	private Date createDatetime;
	private long hospcount;
	private long drugcount;
	private long compcount;
	private String createDatatimeText;
	private Date startTime;
	private Date endTime;
	private String startTimeText;
	private String endTimeText;
	
	@Transient
	public String getStartTimeText() {
		if (null != startTime){
			startTimeText = FormatDate.toShortFormat(startTime);
		}
		return startTimeText;
	}

	public void setStartTimeText(String startTimeText) {
		this.startTimeText = startTimeText;
	}
	@Transient
	public String getEndTimeText() {
		if (null != endTime){
			endTimeText = FormatDate.toShortFormat(endTime);
		}
		return endTimeText;
	}

	public void setEndTimeText(String endTimeText) {
		this.endTimeText = endTimeText;
	}

	@Column(name = "starttime")
	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	@Column(name = "endtime")
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	// Constructors
	@Transient
	public String getCreateDatatimeText() {
		if (null!= createDatetime){
			createDatatimeText = FormatDate.toShortFormat(createDatetime);
		}
		return createDatatimeText;
	}

	public void setCreateDatatimeText(String createDatatimeText) {
		this.createDatatimeText = createDatatimeText;
	}

	/** default constructor */
	public ViewBidprojectId() {
	}

	/** minimal constructor */
	public ViewBidprojectId(String projId) {
		this.projId = projId;
	}

	/** full constructor */
	public ViewBidprojectId(String projId, String projCode, String name,
			String projCat, short status, Date createDatetime, long hospcount,
			long drugcount, long compcount) {
		this.projId = projId;
		this.projCode = projCode;
		this.name = name;
		this.projCat = projCat;
		this.status = status;
		this.createDatetime = createDatetime;
		this.hospcount = hospcount;
		this.drugcount = drugcount;
		this.compcount = compcount;
	}

	// Property accessors

	@Column(name = "proj_id", nullable = false, length = 36)
	public String getProjId() {
		return this.projId;
	}

	public void setProjId(String projId) {
		this.projId = projId;
	}

	@Column(name = "proj_code", length = 100)
	public String getProjCode() {
		return this.projCode;
	}

	public void setProjCode(String projCode) {
		this.projCode = projCode;
	}

	@Column(name = "name", length = 256)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "proj_cat", length = 36)
	public String getProjCat() {
		return this.projCat;
	}

	public void setProjCat(String projCat) {
		this.projCat = projCat;
	}

	@Column(name = "status")
	public short getStatus() {
		return this.status;
	}

	public void setStatus(short status) {
		this.status = status;
	}

	@Column(name = "create_datetime", length = 19)
	public Date getCreateDatetime() {
		return this.createDatetime;
	}

	public void setCreateDatetime(Date createDatetime) {
		this.createDatetime = createDatetime;
	}

	@Column(name = "hospcount")
	public long getHospcount() {
		return this.hospcount;
	}

	public void setHospcount(long hospcount) {
		this.hospcount = hospcount;
	}

	@Column(name = "drugcount")
	public long getDrugcount() {
		return this.drugcount;
	}

	public void setDrugcount(long drugcount) {
		this.drugcount = drugcount;
	}

	@Column(name = "compcount")
	public long getCompcount() {
		return this.compcount;
	}

	public void setCompcount(long compcount) {
		this.compcount = compcount;
	}

	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof ViewBidprojectId))
			return false;
		ViewBidprojectId castOther = (ViewBidprojectId) other;

		return ((this.getProjId() == castOther.getProjId()) || (this
				.getProjId() != null
				&& castOther.getProjId() != null && this.getProjId().equals(
				castOther.getProjId())))
				&& ((this.getProjCode() == castOther.getProjCode()) || (this
						.getProjCode() != null
						&& castOther.getProjCode() != null && this
						.getProjCode().equals(castOther.getProjCode())))
				&& ((this.getName() == castOther.getName()) || (this.getName() != null
						&& castOther.getName() != null && this.getName()
						.equals(castOther.getName())))
				&& ((this.getProjCat() == castOther.getProjCat()) || (this
						.getProjCat() != null
						&& castOther.getProjCat() != null && this.getProjCat()
						.equals(castOther.getProjCat())))
				&& (this.getStatus() == castOther.getStatus())
				&& ((this.getCreateDatetime() == castOther.getCreateDatetime()) || (this
						.getCreateDatetime() != null
						&& castOther.getCreateDatetime() != null && this
						.getCreateDatetime().equals(
								castOther.getCreateDatetime())))
				&& (this.getHospcount() == castOther.getHospcount())
				&& (this.getDrugcount() == castOther.getDrugcount())
				&& (this.getCompcount() == castOther.getCompcount());
	}

	public int hashCode() {
		int result = 17;

		result = 37 * result
				+ (getProjId() == null ? 0 : this.getProjId().hashCode());
		result = 37 * result
				+ (getProjCode() == null ? 0 : this.getProjCode().hashCode());
		result = 37 * result
				+ (getName() == null ? 0 : this.getName().hashCode());
		result = 37 * result
				+ (getProjCat() == null ? 0 : this.getProjCat().hashCode());
		result = 37 * result + this.getStatus();
		result = 37
				* result
				+ (getCreateDatetime() == null ? 0 : this.getCreateDatetime()
						.hashCode());
		result = 37 * result + (int) this.getHospcount();
		result = 37 * result + (int) this.getDrugcount();
		result = 37 * result + (int) this.getCompcount();
		return result;
	}

}